FxCop

Runs FxCop analysis tool to improve code quality.

Intention

FxCop 10.0 has to be downloaded and installed separately and can be retrieved from here: http://www.microsoft.com/en-us/download/details.aspx?id=6544.

The Installer can be found in the Microsoft Windows SDK for Windows 7 or later.
In order to retrieve the installer without installing the whole SDK please refer to the article How to retrieve and install FxCop 10.0? in the SPCAF Knowledgebase.

How is FxCop integrated

If FxCop is installed SPCAF uses the command line tool FxCopCmd.exe which is available in the FxCop installation directory. All assemblies of WSP packages are then analyzed with FxCop and the results are integrated into the SPCAF reports.

Configure installation of FxCop

The integration of FxCop into SPCAF can be adjusted by several configuration parameters. The parameters allow changing for instance the path to FxCop or the applied FxCop ruleset. For a list of all configurable parameters refer to the SPCAF rule which integrates FxCop.

Typical Problems

FxCop only works if all referenced assemblies are available. Therefore SPCAF provides automatically a list of directories to FxCop in which referenced assemblies could be found.
However, FxCop often requires special SharePoint assemblies to analyze assemblies with references to SharePoint assemblies.
A typical error message in case of missing assemblies is:

NOTE: One or more referenced assemblies could not be found. Use the '/directory' or '/reference' switch to specify additional assembly reference search paths."
Finally: FxCop for analysis of SharePoint related assemblies works best if it is executed on a server with SharePoint installed.

Index

Rule Description Type Severity
FXC350201: Assembly should not contain problems which are detected with Microsoft FxCop The assembly will be checked with Microsoft FxCop for potential problems (if the tool is installed). AssemblyFileReference Error
comments powered by Disqus